<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<!DOCTYPE html>
<html lang="en">
<head>	
<title><s:message code="app.title" /></title>
<%@ include file="Include.jsp"%>
<script type="text/javascript">
	
	$(document).ready(function() {
		$("#voyagename").focus();
		
		$('#editVoyage').click(function(){
			$('#voyageForm').attr('action','EditVoyage');
			$('#voyageForm').attr('method','post');
			$('#voyageForm').submit();
		});
	});
	
</script>
<body>
	<div class="container">
		<%@ include file="Menu.jsp"%>
		<h2><s:message code="voyageForm.editheader" /></h2>
		<hr>
		<form:form id="cancelForm">			
		</form:form>
		<form:form class="form-horizontal" method="post" name="voyageForm" id="voyageForm" commandName="voyageForm"
	           modelAttribute="voyageForm" >
			<form:hidden path="voyageid" cssClass="input-medium" id="voyageid" />
			<table class="table table-bordered">
				<tr>
				<th><form:label path="vesselname"><s:message code="vesselForm.vesselname" /></form:label></th>
				<td>
					<form:select path="vesselid" cssClass="input-medium">
						<form:option value="">--SELECT-</form:option>
						<form:options items="${vesselList}" itemLabel="vesselname" itemValue="vesselid" />
						</form:select>
					</td>
					<form:errors cssClass="text-error" path="vesselid" />
					<th><form:label path="cutoff"><s:message code="voyageForm.cutoff" /></form:label></th>
					<td>
						<form:input path="cutoff" cssClass="input-medium" id="cutoff" maxlength="10" tabindex="3" placeholder="DD/MM/YYYY"/>
						<form:errors cssClass="text-error" path="cutoff" />
					</td>
					<th><form:label path="enscutoff"><s:message code="voyageForm.enscutoff" /></form:label></th>
					<td>
						<form:input path="enscutoff" cssClass="input-medium" maxlength="10" tabindex="6" placeholder="DD/MM/YYYY"/>
						<form:errors cssClass="text-error" path="enscutoff" />
					</td>
				</tr>
				<tr>
					<th><form:label path="voyagename"><s:message code="voyageForm.voyagename" /></form:label></th>
					<td><form:input path="voyagename" cssClass="input-medium" id="voyagename" maxlength="40" size="40" tabindex="1" />
					<form:errors cssClass="text-error" path="voyagename" />
					</td>
					<th><form:label path="eta"><s:message code="voyageForm.eta" /></form:label></th>
					<td>
						<form:input path="eta" cssClass="input-medium" id="eta" maxlength="10" tabindex="4" placeholder="DD/MM/YYYY"/>
						<form:errors cssClass="text-error" path="eta" />
					</td>
					<th><form:label path="acdsicutoff"><s:message code="voyageForm.acdsicutoff" /></form:label></th>
					<td>
						<form:input path="acdsicutoff" cssClass="input-medium" maxlength="10" tabindex="7" placeholder="DD/MM/YYYY"/>
						<form:errors cssClass="text-error" path="acdsicutoff" />
					</td>
				</tr>
				<tr>
				<th><form:label path="portid"><s:message code="voyageForm.portname" /></form:label></th>
					<td>
						<form:select path="portid" cssClass="input-medium" tabindex="2">
							<form:option value="">- Select -</form:option>
							<form:options items="${portList}" itemLabel="portname" itemValue="portid" />
						</form:select>
						<form:errors cssClass="text-error" path="portid" />
					</td>
					<th><form:label path="etd"><s:message code="voyageForm.etd" /></form:label></th>
					<td>
						<form:input path="etd" cssClass="input-medium" id="etd" maxlength="10" tabindex="5" placeholder="DD/MM/YYYY"/>
						<form:errors cssClass="text-error" path="etd" />
					</td>
					<th><form:label path="sectorid"><s:message code="app.sector" /></form:label></th>
					<td>
						<form:select path="sectorid" cssClass="input-medium" tabindex="8">
							<form:option value="">- Select -</form:option>
							<form:options items="${sectorMasterList}" itemLabel="sectorname" itemValue="sectorid"/>
						</form:select>
						<form:errors cssClass="text-error" path="sectorid" />
					</td>
				</tr>
				
				<tr>
				<th><form:label path="routine"><s:message code="voyageForm.routine" /></form:label></th>
					<td>
						<form:input path="routine" rows="4" id="routine" cssClass="input-medium" maxlength="15" tabindex="10" placeholder="ie. Singapore, etc."/>
						<form:errors cssClass="text-error" path="routine" />
					</td>
					<th><form:label path="viano"><s:message code="voyageForm.viano" /></form:label></th>
					<td>
						<form:input path="viano" cssClass="input-medium" id="viano" maxlength="10" tabindex="11" placeholder="ie. I23D7"/>
						<form:errors cssClass="text-error" path="viano" />
					</td>
					<th><form:label path="remarks"><s:message code="voyageForm.remarks" /></form:label></th>
					<td>
						<form:input path="remarks" cssClass="input-large" id="remarks" maxlength="20" tabindex="12" placeholder="ie. Import Discharge Only"/> 
					</td>
				</tr>
			</table>
			<button class="btn btn-primary" type="button" id="editVoyage" ><s:message code="add.edit" /></button>
			<button class="btn btn-primary" type="submit" id="cancelVoyage" formaction="ListVoyage" formmethod="get" form="cancelForm"><s:message code="app.cancel" /></button>
		</form:form>
		 <%@ include file="Footer.jsp"%>
	</div>
</body>
</html>